import { Entity, PrimaryGeneratedColumn, Column, OneToMany,  } from "typeorm";
import { ManualTimestamp } from "../decorators/manual-timestamp.decorator";
import { DeputyGeneral } from "./deputy-general.entity";

@Entity("deputy_general_base")
@ManualTimestamp()
export class DeputyGeneralBase {
  @PrimaryGeneratedColumn()
  id!: number;

  @Column({ type: "varchar", length: 100, unique: true })
  name!: string;

  @Column({ type: "varchar", length: 100, nullable: true, comment: "头像图片" })
  head_img!: string;

  @Column({ type: "text", nullable: true })
  description!: string;

  @Column({ type: "int", default: 1 })
  star_level!: number;

  @Column({ type: "int" })
  ap_min!: number;

  @Column({ type: "int" })
  ap_max!: number;

  @Column({ type: "decimal", precision: 4, scale: 2 })
  czl_min!: number;

  @Column({ type: "decimal", precision: 4, scale: 2 })
  czl_max!: number;

  @Column({ type: "int" })
  hp_min!: number;

  @Column({ type: "int" })
  hp_max!: number;

  @Column({ type: "int" })
  mp_min!: number;

  @Column({ type: "int" })
  mp_max!: number;

  @Column({ type: "int" })
  sp_min!: number;

  @Column({ type: "int" })
  sp_max!: number;

  @Column({ type: "tinyint", default: 0, comment: "性别(0:女,1:男)" })
  sex!: number;

  @Column("datetime", { comment: "创建时间" })
  created_at!: Date;

  @Column("datetime", { comment: "更新时间" })
  updated_at!: Date;

  // @OneToMany => DeputyGeneral, (deputy) => deputy.base)
  // deputies!: DeputyGeneral[];
}
